package com.yimu.unknow;

/**
 * @Author YiMu
 * @Date 2020/10/15 9:51
 * @Description 给定一个字符串，请你找出其中不含有重复字符的 最长子串的长度。
 */
public class leetcode {
    public static void main(String[] args) {
        String s = "abcabcbb";
        String[] strings = s.split("");
        int i = 0;
        int i1 = 0;
        int i2 = 1;
        int result = 0;
        if (s.length() == 1) {
            result = 1;
        }
        for (String string : strings) {
            i2=1;
            for (int j = i1; j <= i; j++) {
                System.out.println("j:"+j);
                if ((i+1)== strings.length) {
                    if (result == 0) {
                        result = s.length();
                    }
                    System.out.println(result);
                    return;
                }
                if ((i+1-j)>result) {
                    if (strings[j].equals(strings[i+1])) {
                        System.out.println("等于: "+j+" **"+(i+1)+"  "+strings[j]+strings[i+1]);
                        result = i+1-j;
                        i1=i1+1;
                    }
                }
                i2++;
            }
            System.out.println("i2:"+i2+" "+strings[i+1]);
            i++;
        }
    }
}